<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width,height=device-height,inital-scale=1,maximum-scale=1.0,user-scalable=no">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no"/>
    <meta name="format-detection" content="email=no"/>
    <title>自助买单</title>
    <link type="text/css" rel="stylesheet" href="css/css.css">
    <script type="text/javascript" src="js/jquery-3.2.1.js"></script>
</head>
<body>
</body>
<script type="text/javascript" src="js/common.js"></script>
<script>
    var dealUserId = getQueryString("dealUserId");
    // var i = 2;
    /*
    * 判断打开方式
    * */
    var browser = {
        versions: function () {
            var u = navigator.userAgent,
                app = navigator.appVersion;
            return { //移动终端浏览器版本信息
                trident: u.indexOf('Trident') > -1,
//IE内核
                presto: u.indexOf('Presto') > -1,
//opera内核
                webKit: u.indexOf('AppleWebKit') > -1,
//苹果、谷歌内核
                gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1,
//火狐内核
                mobile: !!u.match(/AppleWebKit.*Mobile.*/),
//是否为移动终端
                ios: !!u.match(/\(i[^;]+;( U;)?CPU. + MacOSX /),
//ios终端
                android: u.indexOf('android') > -1 || u.indexOf('Linux') > -1,
//android终端或uc浏览器
                iPhone: u.indexOf('iPhone') > -1,
//是否为iPhone或者QQHD浏览器
                iPad: u.indexOf('iPad') > -1,
//是否iPad
                webApp: u.indexOf('Safari') == -1
//是否web应该程序，没有头部与底部
            };
        }(),
        language: (navigator.browserLanguage ||
            navigator.language).toLowerCase()
    };
    if (browser.versions.mobile) {//判断是否是移动设备打开。browser代码在下面
        var ua = navigator.userAgent.toLowerCase();//获取判断用的对象
        if (ua.match(/MicroMessenger/i) == "micromessenger") {
            //在微信中打开
            // $.ajax({
            //     url: 'https://wallet.seshell.cn/api/qrpay/redirect',
            //     type: 'POST',
            //     data: {dealUserId:dealUserId,payMode:3},
            //     dataType: "json",
            //     success:function(data){
            //         console.log(data);
            //         if(data.code === 0){
            //             window.location.href = data.data;
            //         }else {
            //             alert(data.msg)
            //         }
            //     }
            // });

            window.location.href = "https://wap.seshell.cn/index.html?dealUserId="+dealUserId+"&payMent=1"
        }
        else if (ua.match(/AlipayClient/i) == 'alipayclient') {
            //支付宝打开';
            // $.ajax({
            //     url: 'https://wallet.seshell.cn/api/qrpay/redirect',
            //     type: 'POST',
            //     data: {dealUserId:dealUserId,payMode:4},
            //     dataType: "json",
            //     success:function(data){
            //         if(data.code === 0){
            //             window.location.href = data.data;
            //         }else {
            //             alert(data.msg)
            //         }
            //     }
            // });


            window.location.href = "https://wap.seshell.cn/index.html?dealUserId=1"+dealUserId+"&payMent=2"
        }
        // else if (ua.match(/MQQBrowser/i)=="mqqbrowser" || ua.match(/qq/i)=="qq") {
        //     //QQ打开
        //     window.location.href = '${webPath}/payment/redirect.htm?dealUserId=$!{dealUserId}&payType=1';
        // }
        else{
            alert("暂未开通，敬请期待！");
        }
    } else {
//否则就是PC浏览器打开
        alert("请在手机上打开！");
    }



</script>
</html>